package server

import (
	"net/http"

	"github.com/julienschmidt/httprouter"
)

// NewServer 创建一个新 Server
func initApis() {
	router := httprouter.New()
	router.GET("/rdemo/demo", routerDemo)
	http.Handle("/rdemo/", router)

	http.Handle("/demon", demonHandler{})
	http.HandleFunc("/demo", demoHandler)
}

// RunServer run a server
func RunServer() error {
	addr := ":9999"
	initApis()
	return http.ListenAndServe(addr, nil)
}
